<template>
  <div class="header">
    <img src="@/assets/images/header-bg.png" alt="" class="header-bg">
    <div class="title">
      <div class="t1">综合能源监控平台</div>
      <div class="t2">天津东沽光伏电站</div>
    </div>
    <div class="header-r">
      <div class="dateTime">
        <div class="time">{{ time }}</div>
        <div class="date">{{ dateT }}</div>
      </div>
      <a href="http://192.168.100.28" class="exit-btn">
        <img src="@/assets/images/icon-exit.png" alt="">
      </a>
<!--      <a href="javascript: window.open('', '_self').close()" >-->
<!--        <img src="@/assets/images/close.png" style="width: 45px;height: 45px" alt="">-->
<!--      </a>-->
    </div>
  </div>
</template>

<script>
export default {
  name: 'pageheader',
  data: function () {
    return {
      time: null,
      dateT: null
    }
  },
  mounted() {
    var _this = this;

    function getTody() {
      let date = new Date();
      let year = new Date().getFullYear();
      let month = new Date().getMonth() + 1;
      let day = new Date().getDate();
      let hour = new Date().getHours();
      let minute = new Date().getMinutes();
      let second = new Date().getSeconds();
      if (month >= 0 && month <= 9) {
        month = "0" + month;
      }
      if (day >= 0 && day <= 9) {
        day = "0" + day;
      }
      if (hour >= 0 && hour <= 9) {
        hour = "0" + hour;
      }
      if (minute >= 0 && minute <= 9) {
        minute = "0" + minute;
      }
      if (second >= 0 && second <= 9) {
        second = "0" + second;
      }
      _this.dateT = year + '.' + month + '.' + day
      _this.time = hour + ':' + minute + ':' + second
    }

    var clock = setInterval(() => {
      getTody()
    }, 1000);
    this.$once("hook:beforeDestroy", () => {
      clearInterval(clock);
    });

  },
}
</script>

<style scoped>
.header {
  padding: 0 32px 0 28px;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  height: 94px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.header .header-bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.header .title {
  display: flex;
  align-items: center;
}

.header .title .t1 {
  font-size: 46px;
  font-family: YouSheBiaoTiHei;
  font-weight: 400;
  color: #FFFFFF;
  font-family: YouSheBiaoTiHei;
  line-height: .8;
  background: linear-gradient(0deg, #98CFFA 0%, #FFFFFF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-box-reflect: below 0 -webkit-linear-gradient(transparent, transparent 20%, rgba(255, 255, 255, .3));
}

.header .title .t2 {
  padding-left: 18px;
  margin-left: 28px;
  font-size: 28px;
  color: #FFFFFF;
  position: relative;
  font-family: SourceHanSansCN-Regular;
}

.header .title .t2::before {
  margin-top: -12px;
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 24px;
  background: linear-gradient(0deg, rgba(0, 236, 243, 0) 0%, rgba(0, 236, 243, 0.99) 46%, rgba(0, 236, 243, 0) 100%);
  border-radius: 50%;
}

.header-r {
  display: flex;
  align-items: center;
}

.header .dateTime {
  font-family: DIN-Regular;
  text-align: right;
  color: #FFFFFF;
}

.header .dateTime .time {
  font-size: 24px;
}

.header .dateTime .date {
  font-size: 16px;
}

.header .exit-btn {
  margin-left: 30px;
  width: 32px;
  height: 32px;
  line-height: 32px;
  font-size: 0;
  cursor: pointer;
}

.header .exit-btn img {
  display: inline-block;
  vertical-align: middle;
  max-width: 100%;
  max-height: 100%;
}
</style>